<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>编辑英雄</title>
</head>
<body>
<script type="text/html" id="form">
    <input type="hidden" name="id" value="{{ d.id }}" />
    <div class="mainBox">
        <div class="main-container">
            <blockquote class="layui-elem-quote">基础信息</blockquote>
            <div class="layui-form-item">
                <label class="layui-form-label"><text title="必填项" style="color:red;">*</text>英雄名称</label>
                <div class="layui-input-block">
                    <input type="text"  name="name" value="{{d.name}}" lay-verify="required" autocomplete="off" placeholder="请输入英雄名称" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><text title="必填项" style="color:red;">*</text>英雄游戏内部ID</label>
                <div class="layui-input-block">
                    <input type="text"  name="hero_id" value="{{d.hero_id}}" lay-verify="required" autocomplete="off" placeholder="请输入英雄内部id" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><text title="必填项" style="color:red;">*</text>称号</label>
                <div class="layui-input-block">
                    <input type="text"  name="nickname" value="{{d.nickname}}" lay-verify="required" autocomplete="off" placeholder="请输入称号" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><text title="必填项" style="color:red;">*</text>职责</label>
                <div class="layui-input-block">
                    <div class="xmSelect"
                         data-name="type"
                         data-sourceType="route"
                         data-source="/admin.lol.hero/type"
                         data-textField="type"
                         data-valueField="type"
                         data-paging="true"
                         data-radio="true"
                         data-layVerify="required"
                         data-direction="down"
                         data-selected="{{d.type}}"
                    ></div>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"><text title="必填项" style="color:red;">*</text>难度</label>
                <div class="layui-input-block">
                    <div class="xmSelect"
                         data-name="difficulty"
                         data-sourceType="route"
                         data-source="/admin.lol.hero/difficulty"
                         data-textField="difficulty"
                         data-valueField="difficulty"
                         data-paging="true"
                         data-radio="true"
                         data-layVerify="required"
                         data-direction="down"
                         data-selected="{{d.difficulty}}"
                    ></div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><text title="必填项" style="color:red;">*</text>英雄半身图</label>
                <div class="layui-input-block">
                    <div class="laytpUpload"
                         data-name="url"
                         data-dir="xm_game/lol/hero/url"
                         data-accept="image"
                         data-type="ali-oss"
                         data-showChoiceBtn="false"
                         data-layVerify="required"
                         data-uploaded="{{ d.url }}"
                         data-uploadedId="{{ d.url }}"
                    ></div>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"><text title="必填项" style="color:red;">*</text>英雄头像</label>
                <div class="layui-input-block">
                    <div class="laytpUpload"
                         data-name="icon"
                         data-dir="xm_game/lol/hero/icon"
                         data-accept="image"
                         data-type="ali-oss"
                         data-showChoiceBtn="false"
                         data-layVerify="required"
                         data-uploaded="{{ d.icon }}"
                         data-uploadedId="{{ d.icon }}"
                    ></div>
                </div>
            </div>
            <blockquote class="layui-elem-quote">最佳搭档</blockquote>
            <div class="layui-form-item">
                <label class="layui-form-label"><text title="必填项" style="color:red;">*</text>搭档英雄1</label>
                <div class="layui-input-inline">
                    <div class="xmSelect"
                         data-name="team[0]"
                         data-sourceType="route"
                         data-source="/admin.lol.hero/index"
                         data-textField="name"
                         data-valueField="id"
                         data-paging="true"
                         data-radio="true"
                         data-layVerify="required"
                         data-direction="down"
                         data-selected="{{ d.team.length>0?d.team[0]:'' }}"
                    ></div>
                </div>
                <label class="layui-form-label"><text title="必填项" style="color:red;">*</text>搭档英雄2</label>
                <div class="layui-input-inline">
                    <div class="xmSelect"
                         data-name="team[1]"
                         data-sourceType="route"
                         data-source="/admin.lol.hero/index"
                         data-textField="name"
                         data-valueField="id"
                         data-paging="true"
                         data-radio="true"
                         data-layVerify="required"
                         data-direction="down"
                         data-selected="{{ d.team.length>1?d.team[1]:'' }}"
                    ></div>
                </div>
                <label class="layui-form-label"><text title="必填项" style="color:red;">*</text>搭档英雄3</label>
                <div class="layui-input-inline">
                    <div class="xmSelect"
                         data-name="team[2]"
                         data-sourceType="route"
                         data-source="/admin.lol.hero/index"
                         data-textField="name"
                         data-valueField="id"
                         data-paging="true"
                         data-radio="true"
                         data-layVerify="required"
                         data-direction="down"
                         data-selected="{{ d.team.length>2?d.team[2]:'' }}"
                    ></div>
                </div>
            </div>
            <blockquote class="layui-elem-quote">克制英雄</blockquote>
            <div class="layui-form-item">
                <label class="layui-form-label">克制英雄1</label>
                <div class="layui-input-inline">
                    <div class="xmSelect"
                         data-name="restraint[0]"
                         data-sourceType="route"
                         data-source="/admin.lol.hero/index"
                         data-textField="name"
                         data-valueField="id"
                         data-paging="true"
                         data-radio="true"
                         data-direction="up"
                         data-selected="{{ d.restraint.length>0?d.restraint[0]:'' }}"
                    ></div>
                </div>
                <label class="layui-form-label">克制英雄2</label>
                <div class="layui-input-inline">
                    <div class="xmSelect"
                         data-name="restraint[1]"
                         data-sourceType="route"
                         data-source="/admin.lol.hero/index"
                         data-textField="name"
                         data-valueField="id"
                         data-paging="true"
                         data-radio="true"
                         data-direction="up"
                         data-selected="{{ d.restraint.length>1?d.restraint[1]:'' }}"

                    ></div>
                </div>
                <label class="layui-form-label">克制英雄3</label>
                <div class="layui-input-inline">
                    <div class="xmSelect"
                         data-name="restraint[2]"
                         data-sourceType="route"
                         data-source="/admin.lol.hero/index"
                         data-textField="name"
                         data-valueField="id"
                         data-paging="true"
                         data-radio="true"
                         data-direction="up"
                         data-selected="{{ d.restraint.length>2?d.restraint[2]:'' }}"

                    ></div>
                </div>
            </div>
            <blockquote class="layui-elem-quote">被克制英雄</blockquote>
            <div class="layui-form-item">
                <label class="layui-form-label">被克制英雄1</label>
                <div class="layui-input-inline">
                    <div class="xmSelect"
                         data-name="restrained[0]"
                         data-sourceType="route"
                         data-source="/admin.lol.hero/index"
                         data-textField="name"
                         data-valueField="id"
                         data-paging="true"
                         data-radio="true"
                         data-direction="up"
                         data-selected="{{ d.restrained.length>0?d.restrained[0]:'' }}"
                    ></div>
                </div>
                <label class="layui-form-label">被克制英雄2</label>
                <div class="layui-input-inline">
                    <div class="xmSelect"
                         data-name="restrained[1]"
                         data-sourceType="route"
                         data-source="/admin.lol.hero/index"
                         data-textField="name"
                         data-valueField="id"
                         data-paging="true"
                         data-radio="true"
                         data-direction="up"
                         data-selected="{{ d.restrained.length>1?d.restrained[1]:'' }}"

                    ></div>
                </div>
                <label class="layui-form-label">被克制英雄3</label>
                <div class="layui-input-inline">
                    <div class="xmSelect"
                         data-name="restrained[2]"
                         data-sourceType="route"
                         data-source="/admin.lol.hero/index"
                         data-textField="name"
                         data-valueField="id"
                         data-paging="true"
                         data-radio="true"
                         data-direction="up"
                         data-selected="{{ d.restrained.length>2?d.restrained[2]:'' }}"
                    ></div>
                </div>
            </div>
            <!--<div class="layui-form-item">
                <blockquote class="layui-elem-quote">皮肤</blockquote>
                <div class="layui-inline">
                    <label class="layui-form-label">
                        皮肤名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="skin_name1" value="{{d.skin_name1}}" autocomplete="off"
                               placeholder="请输入皮肤名称" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-block">
                        <div class="laytpUpload"
                             data-name="skin_url1"
                             data-accept="image"
                             data-type="ali-oss"
                             data-uploaded="{{ d.skin_url1}}"
                             data-uploadedId="{{ d.skin_url1}}"
                             data-showChoiceBtn="false"
                        ></div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">
                        皮肤名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="skin_name2" value="{{d.skin_name2}}" autocomplete="off"
                               placeholder="请输入皮肤名称" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-block">
                        <div class="laytpUpload"
                             data-name="skin_url2"
                             data-accept="image"
                             data-type="ali-oss"
                             data-uploaded="{{ d.skin_url2}}"
                             data-uploadedId="{{ d.skin_url2}}"
                             data-showChoiceBtn="false"
                        ></div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">
                        皮肤名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="skin_name3" value="{{d.skin_name3}}" autocomplete="off"
                               placeholder="请输入皮肤名称" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-block">
                        <div class="laytpUpload"
                             data-name="skin_url3"
                             data-accept="image"
                             data-type="ali-oss"
                             data-uploaded="{{ d.skin_url3}}"
                             data-uploadedId="{{ d.skin_url3}}"
                             data-showChoiceBtn="false"
                        ></div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">
                        皮肤名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="skin_name4" value="{{d.skin_name4}}" autocomplete="off"
                               placeholder="请输入皮肤名称" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-block">
                        <div class="laytpUpload"
                             data-name="skin_url4"
                             data-accept="image"
                             data-type="ali-oss"
                             data-uploaded="{{ d.skin_url4}}"
                             data-uploadedId="{{ d.skin_url4}}"
                             data-showChoiceBtn="false"
                        ></div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">
                        皮肤名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="skin_name5" value="{{d.skin_name5}}" autocomplete="off"
                               placeholder="请输入皮肤名称" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-block">
                        <div class="laytpUpload"
                             data-name="skin_url5"
                             data-accept="image"
                             data-type="ali-oss"
                             data-uploaded="{{ d.skin_url5}}"
                             data-uploadedId="{{ d.skin_url5}}"
                             data-showChoiceBtn="false"
                        ></div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">
                        皮肤名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="skin_name6" value="{{d.skin_name6}}" autocomplete="off"
                               placeholder="请输入皮肤名称" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-block">
                        <div class="laytpUpload"
                             data-name="skin_url6"
                             data-accept="image"
                             data-type="ali-oss"
                             data-uploaded="{{ d.skin_url6}}"
                             data-uploadedId="{{ d.skin_url6}}"
                             data-showChoiceBtn="false"
                        ></div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">
                        皮肤名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="skin_name7" value="{{d.skin_name7}}" autocomplete="off"
                               placeholder="请输入皮肤名称" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-block">
                        <div class="laytpUpload"
                             data-name="skin_url7"
                             data-accept="image"
                             data-type="ali-oss"
                             data-uploaded="{{ d.skin_url7}}"
                             data-uploadedId="{{ d.skin_url7}}"
                             data-showChoiceBtn="false"
                        ></div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">
                        皮肤名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="skin_name8" value="{{d.skin_name8}}" autocomplete="off"
                               placeholder="请输入皮肤名称" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-block">
                        <div class="laytpUpload"
                             data-name="skin_url8"
                             data-accept="image"
                             data-type="ali-oss"
                             data-uploaded="{{ d.skin_url8}}"
                             data-uploadedId="{{ d.skin_url8}}"
                             data-showChoiceBtn="false"
                        ></div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">
                        皮肤名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="skin_name9" value="{{d.skin_name9}}" autocomplete="off"
                               placeholder="请输入皮肤名称" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-block">
                        <div class="laytpUpload"
                             data-name="skin_url9"
                             data-accept="image"
                             data-type="ali-oss"
                             data-uploaded="{{ d.skin_url9}}"
                             data-uploadedId="{{ d.skin_url9}}"
                             data-showChoiceBtn="false"
                        ></div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">
                        皮肤名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="skin_name10" value="{{d.skin_name10}}" autocomplete="off"
                               placeholder="请输入皮肤名称" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-block">
                        <div class="laytpUpload"
                             data-name="skin_url10"
                             data-accept="image"
                             data-type="ali-oss"
                             data-uploaded="{{ d.skin_url10}}"
                             data-uploadedId="{{ d.skin_url10}}"
                             data-showChoiceBtn="false"
                        ></div>
                    </div>
                </div>
            </div>-->
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="laytp-btn laytp-btn-primary laytp-btn-sm" lay-submit="" lay-filter="laytp-form">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="laytp-btn laytp-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</script>
<form class="layui-form" lay-filter="layui-form">
</form>
<script>
    if(localStorage.getItem("staticDomain")){
        document.write("<link rel='stylesheet' href='" + localStorage.getItem("staticDomain") + "/component/layui/css/layui.css?v=" + localStorage.getItem("version") + "'>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/layui/layui.js?v="+localStorage.getItem("version")+"'><\/script>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/laytp/layuiConfig.js?v="+localStorage.getItem("version")+"'><\/script>");
    }else{
        document.write("<link rel='stylesheet' href='/static/component/layui/css/layui.css?v=" + localStorage.getItem("version") + "'>");
        document.write("<script src='/static/component/layui/layui.js?v="+localStorage.getItem("version")+"'><\/script>");
        document.write("<script src='/static/component/laytp/layuiConfig.js?v="+localStorage.getItem("version")+"'><\/script>");
    }
</script>
<script>
    layui.use(['laytp'],function(){
        let form = layui.form;
        let $ = layui.jquery;
        //获取参数ID
        var id = facade.getUrlParam('id');
        if(!id){
            facade.error('参数ID不能为空');
            return false;
        }

        //获取数据，渲染到对应的节点上
        facade.ajax({
            route: "/admin.lol.hero/info",
            data: {id: id},
            successAlert: false,
            showLoading: true
        }).done(function(res){
            if(res.code === 0){
                layui.laytpl($("#form").html()).render(res.data,function(string){
                    $("form").html(string);
                    layui.laytpForm.render();
                    form.render();
                });
            }
        });

        form.on('submit(laytp-form)', function(data){
            var btnAnim = layui.button.load({elem:$(this)});
            facade.ajax({
                route:'/admin.lol.hero/edit',
                data:data.field
            }).done(function(res){
                if(res.code === 0){
                    parent.layui.layer.close(parent.layui.layer.getFrameIndex(window.name));//关闭当前页
                    parent.layui.table.reload("laytp-table");
                }
                btnAnim.stop();
            }).fail(function(){
                btnAnim.stop();
            });
            return false;
        });
    })
</script>
</body>
</html>